from django.db import models

# Create your models here.

# 分类
class category(models.Model):
    title = models.CharField(max_length=32)
    status = models.IntegerField()
    router = models.CharField(max_length=256,null=True)
    def __str__(self):
        return self.title

# 作者
class author(models.Model):
    name = models.CharField(max_length=32)
    phone = models.CharField(max_length=11,unique=True)
    password = models.CharField(max_length=128)
    token = models.CharField(max_length=128)

# 文章
class article(models.Model):
    title = models.CharField(max_length=32)
    content = models.TextField()
    author = models.ForeignKey(author,on_delete=models.DO_NOTHING)
    category = models.ManyToManyField(category)

